# -*- coding: utf-8 -*-
import codecs
import os


def combine_file(name, slug):
    for root, dirs, files in os.walk(slug + "/txt", topdown=False):
        f = codecs.open(name + '.txt', 'w', 'utf-8')
        for name in sorted(files):
            with open(os.path.join(root, name), 'r') as tf:
                f.write(tf.read())
                f.write('\n\n')
        f.close()
